package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.service.wx.WxCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author jzp
 * @since 2022/11/22 14:51
 */
@RestController
@RequestMapping("wx/collect/")
public class WxCollect {
    @Autowired
    WxCollectService wxCollectService;


    @RequestMapping("list")
    public BaseRespVo list(Integer type,Integer page,Integer limit){
        CommonData commonData = wxCollectService.list(type,page,limit);
        return BaseRespVo.succeed(commonData);
    }
    @RequestMapping("addordelete")
    public BaseRespVo addOrDelete(@RequestBody Map map){
        Integer type = (Integer) map.get("type");
        Integer valueId = (Integer) map.get("valueId");

        wxCollectService.addOrDelete(type,valueId);
        return BaseRespVo.succeed();
    }
}
